<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <meta name="keywords" content="质慧民生|APP上线活动！">
    <meta name="description" content="质慧民生|APP上线活动参与分享下载安装赢话费！">
    <title>邀请好友赢大奖</title>
    <link href="app2017_6.css" rel="stylesheet">
</head>
<body>
<div class="Explain">
    <ul>
        <li>
            邀请好友注册「质惠民生App」，好友完成注册后，你可获得1.99元话费。
        </li>
        <li>
            邀请好友越多，获得的奖励越多。
        </li>
        <li>
            活动流程：注册并登录App—点击首页“活动专题页”— 分享专题页
        </li>
    </ul>
</div>
<div class="btnBox">
    <input type="button" id="Explainope" class="btn1" value="活动细则">
    <input type="button" id="yaoqinghaoyou" class="btn2" value="邀请好友">
    <a id="linkedme" class="btn2" href="https://lkme.cc/eyC/UkEMcsFz9?scan=1">打开APP</a>
</div>
<div class="state">
    尚未成功邀请好友，立即分享吧 →【邀请好友】
</div>
<div class="maxExplainBox">
    <div class="maxExplain">
        <div class="maxExplainTil">
            <div id="Explaincls"></div>
        </div>
        <ul>
            <li id="aassdd">
                注册用户登录App后，将此活动专题页分享给好友，好友注册App后，分享人即可获得1.99元话费奖励。
            </li>
            <li>
                话费奖励可累计，邀请好友越多，奖励越多，话费金额无上限。
            </li>
            <li>
                分享的对象仅限新注册用户，多次重复注册不计入分享次数，每个手机号码、每台终端设备仅统计一次。
            </li>
            <li>
                本活动的最终解释权归质惠民生所有。
            </li>
        </ul>
    </div>
</div>
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
var response;

    function setupWebViewJavascriptBridge(callback) {
        if (window.WebViewJavascriptBridge) {
            return callback(WebViewJavascriptBridge);
        }
        if (window.WVJBCallbacks) {
            return window.WVJBCallbacks.push(callback);
        }
        window.WVJBCallbacks = [callback];
        var WVJBIframe = document.createElement('iframe');
        WVJBIframe.style.display = 'none';
        WVJBIframe.src = 'wvjbscheme://__BRIDGE_LOADED__';
        document.documentElement.appendChild(WVJBIframe);
        setTimeout(function () {
            document.documentElement.removeChild(WVJBIframe)
        }, 0)
    }

    setupWebViewJavascriptBridge(function (bridge) {

        /* Initialize your app here */

        bridge.registerHandler('JS Echo', function (data, responseCallback) {
            console.log("JS Echo called with:", data)
            responseCallback(data)
        })
        bridge.callHandler('callUserIdFromWeb', {'key': 'value'}, function responseCallback(responseData) {
            window.alert(responseData);
        })
    })


    function testClick() {
        var data = "{'key':'123','value':'44444'}";
        // 　window.alert("欢迎！请按“确定”继续。");

        //调用java中的方法   submitFromWeb是方法名

        window.WebViewJavascriptBridge.callHandler(
                'callDeepShareFromWeb'
                , {'param': data}
                , function (responseData) {
                    alert(responseData)

                }
        );
    }

    function shareClick() {
        if (window.WebViewJavascriptBridge) {
            testClick();
        } else {
            document.addEventListener('WebViewJavascriptBridgeReady', function () {
                        testClick();
                    }, false);
        }

    }


    function loadUserData() {
        if (window.WebViewJavascriptBridge) {
            queryUserInfo();
        } else {
            document.addEventListener('WebViewJavascriptBridgeReady', function () {
                queryUserInfo();
            }, false);
        }

    }

    function queryUserInfo(){
        window.WebViewJavascriptBridge.callHandler('callUserIdFromWeb','99', function (responseData) {
                    // alert(responseData);
                    // var temp = JSON.parse(responseData);
                       $('.maxExplainBox').show();
                       response = responseData;
                         $('#aassdd').html("........."+ response +"............");
                    //    alert(66);
                    //    alert(temp)
                }
        );
    }


    ///-------------------------------------------

    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == variable) {
                return pair[1];
            }
        }
        return (false);
    }

    window.onload = function () {
      

    }


    document.getElementById('linkedme').onclick = function () {
        var deeplink_url = getQueryVariable('linkedme') + '?scan=1';
        deeplink_url = deeplink_url.split('?')[0];
        linkedme.trigger_deeplink(deeplink_url, 1);
    }


    $(function () {
         $('#aassdd').html("........."+ response +"............");
        var $yaoqinghaoyou = $('#yaoqinghaoyou'), $linkedme = $('#linkedme');
        var str =  window.location.search,substr = "linkedme";
        function isContains(str, substr) {
            return new RegExp(substr).test(str);
        }
        if(isContains(str, substr)){
            $yaoqinghaoyou.hide();
            $linkedme.show();
            document.getElementById("linkedme").setAttribute("href", getQueryVariable('linkedme') + '?scan=1');
        }else{
            $yaoqinghaoyou.show();
            $linkedme.hide();
            loadUserData();
        };


        
    // alert(11)
        // loadUserData();
    // alert(22)

        document.body.addEventListener('touchstart', function () {
        });
        document.body.addEventListener('touchmove', function (e) {
        });
        $('#Explainope').on('click', function () {
            $('.maxExplainBox').show()
        })
        $('#Explaincls').on('click', function () {
            $('.maxExplainBox').hide()
        })

        $('#yaoqinghaoyou').on('click', function (e) {

                shareClick();

        })
   $('a[title="站长统计"]').parent('span').remove();
    })
</script>
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1262355566'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1262355566%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script>
</body>
</html>